function getBase64 (path) {
    var img = new Image();
    img.src = path; // 传过来的图片路径在这里用。
    img.onload = function() {
        var that = this;
        console.log("wh = " + that.width + "," + that.height);
        //生成比例 
        var w = that.width,
            h = that.height,
            scale = w / h;
        w = 480 || w; //480  你想压缩到多大，改这里
        h = w / scale;
        //生成canvas
        var canvas = document.createElement('canvas');

        var ctx = canvas.getContext('2d');

        canvas.width = w;
        canvas.height = h;

        ctx.drawImage(that, 0, 0, w, h);

        var base64 = canvas.toDataURL('image/jpeg', 1 || 0.8); //1最清晰，越低越模糊。
        base64 = base64.toString().replace('data:image/jpg;base64,','');
        base64 = base64.toString().replace('data:image/jpeg;base64,','');
        alert(base64);
        return base64;
	}
}
    

function readText () {
	var main = plus.android.runtimeMainActivity();
	var SynthesizerPlayer = plus.android.importClass('com.iflytek.speech.SynthesizerPlayer');
	var play = SynthesizerPlayer.createSynthesizerPlayer(main,'appid=5177d8fe');
	play.playText('水果',null,null);
}
//测试已通过
function get64Date (path) {
	var result;
	plus.io.requestFileSystem(plus.io.PRIVATE_WWW,
	function(fs) {
	    var rootEntry = fs.root;
	    var reader = null;
	    rootEntry.getFile(path, {},
	    function(entry) {
	        entry.file(function(file) {
	            reader = new plus.io.FileReader();
	            reader.onloadend = function(e) {
	                plus.console.log("Read success");
	                // Get data
	                result = e.target.result;
//	                删除头文件
                    result = result.replace('data:image/jpg;base64,,','');
                    result = result.replace('data:image/jpeg;base64,,','');
			alert(result);
	                plus.console.log(e.target.result);
	            };
	            reader.readAsDataURL(file);
	        },
	        function(e) {
	            alert(e.message);
	        });
	    });
	
	});
	return rsult;
}